<?php
/**
 * Created by PhpStorm.
 * User: River
 * Email: river0428@gmail.com
 * Date: 2018/11/12
 * Time: 上午10:30
 */

namespace Modules\ApiV2\Controllers;

use App\Models\Article;

class ArticleController extends BaseController
{
    public function category()
    {
        $data['items'] = Article::whereNull('parent_id')->where('is_category', 1)->get(['id', 'title']);

        return success($data);
    }

    public function article($id)
    {
        $data['items'] = Article::where('parent_id', $id)->where('is_category', 0)->get(['id', 'title', 'intro']);

        return success($data);
    }
}